package cn.duli.xianer.service.impl;

import cn.duli.xianer.dao.GoodsMapper;
import cn.duli.xianer.pojo.Goods;
import cn.duli.xianer.service.GoodsService;
import com.github.pagehelper.Page;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Set;

@Service
public class GoodsServiceImpl implements GoodsService {

    @Resource
    private GoodsMapper goodsMapper;

    @Override
    public int save(Goods goods) {
        goodsMapper.save(goods);
        return goods.getgId();
    }

    @Override
    public void update(Goods goods) {
        goodsMapper.update(goods);
    }

    @Override
    public Goods findById(Integer gId) {
        return goodsMapper.findById(gId);
    }

    @Override
    public void deleteById(Integer gId) {
        goodsMapper.deleteById(gId);
    }

    @Override
    public void cancelDeleteById(Integer gId) {
        goodsMapper.cancelDeleteById(gId);
    }

    @Override
    public void shelveById(Integer gId) {
        goodsMapper.shelveById(gId);
    }

    @Override
    public void cancelShelveById(Integer gId) {
        goodsMapper.cancelShelveById(gId);
    }

    @Override
    public Page<Goods> findShelveByUserId(Integer gUid) {
        return goodsMapper.findShelveByUserId(gUid);
    }

    @Override
    public Page<Goods> findVerifyIngByUid(Integer gUid) {
        return goodsMapper.findVerifyIngByUid(gUid);
    }

    @Override
    public Page<Goods> findDieVerifyByUid(Integer gUid) {
        return goodsMapper.findDieVerifyByUid(gUid);
    }

    @Override
    public Page<Goods> findAllVerifyIng() {
        return goodsMapper.findAllVerifyIng();
    }

    @Override
    public Page<Goods> findDieVerify() {
        return goodsMapper.findDieVerify();
    }

    @Override
    public Page<Goods> findSellIng() {
        return goodsMapper.findSellIng();
    }

    @Override
    public Page<Goods> findShelved() {
        return goodsMapper.findShelved();
    }

    @Override
    public void updateMode(Goods goods) {
        goodsMapper.updateMode(goods);
    }

    @Override
    public Page<Goods> findByUserId(Integer gUid) {
        return goodsMapper.findByUserId(gUid);
    }

    @Override
    public Page<Goods> findAll() {
        return goodsMapper.findAll();
    }

    @Override
    public Page<Goods> queryLikeByGoodName(String gName) {
        return goodsMapper.queryLikeByGoodName(gName);
    }

    @Override
    public Page<Goods> queryLikeByTypeName(String tName) {
        return goodsMapper.queryLikeByTypeName(tName);
    }

    @Override
    public Page<Goods> queryLikeByAddr(String gAddr) {
        return goodsMapper.queryLikeByAddr(gAddr);
    }

    @Override
    public Page<Goods> queryByTimeInterval(String startTime, String endTime) {
        return goodsMapper.queryByTimeInterval(startTime, endTime);
    }

    @Override
    public Page<Goods> queryByTypeTwoLevelId(Integer tId) {
        return goodsMapper.queryByTypeTwoLevelId(tId);
    }

    @Override
    public void updateViewNum(Goods goods) {
        goodsMapper.updateViewNum(goods);
    }

    @Override
    public Page<Goods> queryDynamic(String startTime, String endTime, String lowPrice, String topPrice, String gLevel, String gTid) {
        return goodsMapper.queryDynamic(startTime, endTime, lowPrice, topPrice, gLevel, gTid);
    }

    @Override
    public List<Goods> findGlevel() {
        return goodsMapper.findGlevel();
    }

    @Override
    public List<Goods> topByViewNum() {
        return goodsMapper.topByViewNum();
    }

    @Override
    public List<Goods> topNewTime() {
        return goodsMapper.topNewTime();
    }

    @Override
    public List<Goods> findAllByUserId(Integer gUid) {
        return goodsMapper.findAllByUserId(gUid);
    }

    @Override
    public int findGoodsCount() {
        return goodsMapper.findGoodsCount();
    }

    @Override
    public List<Goods> findRecommend(Set<Integer> set, Integer gId, Integer count) {
        return goodsMapper.findRecommend(set, gId, count);
    }

    @Override
    public List<Goods> findByIds(Set<Integer> ids) {
        return goodsMapper.findByIds(ids);
    }

    @Override
    public List<Goods> queryByTimeIntervalTwo(String startTime, String endTime) {
        return goodsMapper.queryByTimeIntervalTwo(startTime, endTime);
    }
}
